{extend name="public:base" /}
{block name="css"}
<!--引入时间插件-->
<link rel="stylesheet" href="__STATIC__/daterangepicker/daterangepicker.css"/>
<!-- 引入layui样式 -->
<link rel="stylesheet" type="text/css" href="__STATIC__/common/layui/css/layui.css">
<!--自定义css样式文件-->
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/css/style-yw.css">
<link rel="stylesheet" href="__STATIC__/admin/css/jb.css"/>
<!--多选样式-->
<!--引入多选样式-->
<link rel="stylesheet" href="__STATIC__/admin/assets/css/bootstrap-multiselect.css" type="text/css">
<style>
    .btn-group{width: 100%;}
    .btn-group button{width: 100%;background: white !important;color: #333 !important;}
    .btn-group button:hover{background: white !important;}
    .btn-group button:active{background: white !important;}
    .open .btn.dropdown-toggle{background: white !important;width: 100%;overflow: hidden;text-overflow: ellipsis;}
    .dropdown-menu > li:hover > a,
    .dropdown-menu > li > a:focus,
    .dropdown-menu > li > a:active,
    .dropdown-menu > li.active > a,
    .dropdown-menu > li.active:hover > a {background: #ffffff;color: #333;}
    .btn-group > .btn > .caret{margin-top: 0;border-top-color: #333;}
    .wrap{width: 60px;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;display: -moz-box;-moz-line-clamp: 2;-moz-box-orient: vertical;-webkit-box-orient: vertical;-webkit-line-clamp: 2;cursor: pointer;word-wrap:break-word;}
    .wrap img{width: auto;height:50px;float: left}
    .layui-layer-tips{word-wrap:break-word;}
    .layui-layer-btn{background: #F8F8F8;border-top: 1px solid #eee;}
    .layui-layer-btn .layui-layer-btn0{border: 1px solid #dedede !important;background: #ffffff !important;color: #333 !important;}
    .layui-layer-btn .layui-layer-btn1{border: 1px solid #1E9FFF;background: #1E9FFF;color: #fff;}
</style>
{/block}
{block name="theme"}业务管理{/block}
{block name="small_theme"}业务列表{/block}
<!--body wrapper start-->
{block name="content"}
<div class="wrapper">
    <div class="row" style="margin:0;">
        <div class="col-sm-12">
            <section class="panel">
                <header class="panel-heading">
                    <div class="yw_form">
                        <form method="get" class="form-inline" action="{:url('olist')}">
                            <div class="boxFirst">
                                <div class="form-group">
                                    <label>唯一标识:</label>
                                    <input type="" class="form-control" name="only" placeholder="ID/姓名/电话" value="{$form.only}">
                                </div>
                                <!--<div class="form-group">-->
                                    <!--<label>订单ID:</label>-->
                                    <!--<input type="" class="form-control" name="id" placeholder="ID" value="{$form.id}">-->
                                <!--</div>-->
                                <!--<div class="form-group">-->
                                    <!--<label>家长姓名:</label>-->
                                    <!--<input type="" class="form-control" name="name_z" placeholder="顾客姓名" value="{$form.name_z}">-->
                                <!--</div>-->
                                <!--<div class="form-group">-->
                                    <!--<label>联系电话:</label>-->
                                    <!--<input type="" class="form-control" name="phone_z" placeholder="电话" value="{$form.phone_z}">-->
                                <!--</div>-->
                                <!--<div class="form-group">-->
                                    <!--<label>联系电话2:</label>-->
                                    <!--<input type="" class="form-control" name="phone_f" placeholder="电话" value="{$form.phone_f}">-->
                                <!--</div>-->
                                <div class="form-group">
                                    <label>QQ:</label>
                                    <input type="" class="form-control" name="qq" placeholder="QQ" value="{$form.qq}">
                                </div>
                                <div class="form-group">
                                    <label>微信:</label>
                                    <input type="" class="form-control" name="wechat" placeholder="微信" value="{$form.wechat}">
                                </div>
                            </div>
                            <div class="boxSecond">
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">订单状态:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="state" id="state_text">
                                        <select class="form-control" id="state" multiple="multiple" style="display: none;">
                                            {volist name="state" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['state']"}selected="selected"{/in}>{$data.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <!--<div class="col-lg-2 col-md-3 form-group-list">-->
                                    <!--<label class="col-md-3">拍摄类别:</label>-->
                                    <!--<div class="col-md-9">-->
                                        <!--<input type="hidden" name="leibie" id="leibie_text">-->
                                        <!--<select class="form-control" id="leibie" multiple="multiple" style="display: none;">-->
                                            <!--{volist name="leibie" id="data"}-->
                                            <!--<option value="{$data.id}" {in name="data.id" value="$form['leibie']" }selected="selected" {/in}>{$data.title}</option>-->
                                            <!--{/volist}-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">拍摄方式:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="shot_mode" id="shot_mode_text">
                                        <select class="form-control" id="shot_mode" multiple="multiple" style="display: none;">
                                            {volist name="shotmode" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['shot_mode']" }selected="selected" {/in}>{$data.title}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <!--<div class="col-lg-2 col-md-3 form-group-list">-->
                                    <!--<label class="col-md-3">区域:</label>-->
                                    <!--<div class="col-md-9">-->
                                        <!--<input type="hidden" name="diqu" id="diqu_text">-->
                                        <!--<select class="form-control" id="diqu" multiple="multiple" style="display: none;">-->
                                            <!--{volist name="area" id="data"}-->
                                            <!--<option value="{$data.id}" {in name="data.id" value="$form['diqu']" }selected="selected" {/in}>{$data.name}</option>-->
                                            <!--{/volist}-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">建单人员:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="jdry" id="jdry_text">
                                        <select class="form-control" id="jdry" multiple="multiple" style="display: none;">
                                            {volist name="userall" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['jdry']" }selected="selected" {/in}>{$data.username}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">邀约组:</label>
                                    <div class="col-md-9">
                                        <select class="form-control" id="yykf_group" name="yykf_group">
                                            <option value="">全部</option>
                                            {volist name="yykf_group" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['yykf_group']" }selected="selected" {/in}>{$data.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">邀约人员:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="yykf" id="yykf_text">
                                        <select class="form-control" id="yykf" multiple="multiple" style="display: none;">
                                            {volist name="yykf" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['yykf']" }selected="selected" {/in}>{$data.username}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">门店:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="mendian" id="mendian_text">
                                        <select class="form-control" id="mendian" multiple="multiple" style="display: none;">
                                            {volist name="mendian" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['mendian']" }selected="selected"{/in}>{$data.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">门市:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="menshi" id="menshi_text">
                                        <select class="form-control" id="menshi" multiple="multiple" style="display: none;">
                                            {volist name="menshi" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['menshi']" }selected="selected" {/in}>{$data.username}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">渠道组:</label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="jdry_group" id="jdry_group">
                                            <option value="">全部</option>
                                            {volist name="jdry_group" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['jdry_group']" }selected="selected" {/in}>{$data.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">渠道:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="channel" id="channel_text">
                                        <select class="form-control" id="channel" multiple="multiple" style="display: none;">
                                            {volist name="channel" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['channel']"}selected="selected" {/in} >{$data.title}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">来源:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="source" id="source_text">
                                        <select class="form-control" id="source" multiple="multiple" style="display: none !important;">
                                            {volist name="source" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['source']"}selected="selected" {/in}>{$data.title}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">班级:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="banji" id="banji_text">
                                        <select class="form-control" id="banji" multiple="multiple" style="display: none !important;">
                                            {volist name="banji" id="data"}
                                            <option value="{$data.id}" {in name="data.id" value="$form['banji']"}selected="selected" {/in}>{$data.banjiname}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list">
                                    <label class="col-md-3">星期:</label>
                                    <div class="col-md-9">
                                        <input type="hidden" name="xingqi" id="xingqi_text">
                                        <select class="form-control" id="xingqi" multiple="multiple" style="display: none !important;">
                                            {volist name="xingqi" id="data"}
                                            <option value="{$data}" {in name="data" value="$form['xingqi']"}selected="selected" {/in}>{$data}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-2 col-md-3 form-group-list"  id="shangkeshijian">
                                    <label class="col-md-3">上课时间:</label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" placeholder="" style="width: 100%;" name="shijianduan" value="{$form.shijianduan}" id="shijianduan">
                                    </div>
                                </div>
                                <!--<div class="col-lg-2 col-md-3 form-group-list">-->
                                    <!--<label class="col-md-3">异常:</label>-->
                                    <!--<div class="col-md-9">-->
                                        <!--<select class="form-control" id="" name="ycpp">-->
                                            <!--<option value="">全部</option>-->
                                            <!--<option value="1" {eq name="form['ycpp']" value="1" }selected="selected" {/eq}>未匹配</option>-->
                                            <!--<option value="2" {eq name="form['ycpp']" value="2" }selected="selected" {/eq}>异常</option>-->
                                            <!--<option value="3" {eq name="form['ycpp']" value="3" }selected="selected" {/eq}>正常</option>-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <!--<div class="col-lg-2 col-md-3 form-group-list">-->
                                    <!--<label class="col-md-3">流失原因:</label>-->
                                    <!--<div class="col-md-9">-->
                                        <!--<select class="form-control" name="lsyy">-->
                                            <!--<option value="">全部</option>-->
                                            <!--{volist name="lsyy" id="data"}-->
                                            <!--<option value="{$data.id}" {eq name="form['lsyy']" value="$data.id"}selected="selected" {/eq}>{$data.name}</option>-->
                                            <!--{/volist}-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <!--<div class="col-lg-2 col-md-3 form-group-list">-->
                                    <!--<label class="col-md-4">金平台分享:</label>-->
                                    <!--<div class="col-md-8">-->
                                        <!--<select class="form-control" name="jpttj">-->
                                            <!--<option value="">全部</option>-->
                                            <!--<option value="1" {eq name="form['jpttj']" value="1" }selected="selected" {/eq}>分享</option>-->
                                        <!--</select>-->
                                    <!--</div>-->
                                <!--</div>-->
                            </div>
                            <div class="boxThree">
                                <div class="form-group" id="reportrange-1">
                                    <label>建单时间:</label>
                                    <input type="text" class="form-control form-time" name="jdtime" value="{$form.jdtime}" id="jdtime">
                                </div>
                                <div class="form-group">
                                    <label>邀约分配时间:</label>
                                    <input type="text" class="form-control form-time" name="yyfptime" value="{$form.yyfptime}" id="yyfptime">
                                </div>
                                <div class="form-group">
                                    <label>追踪时间:</label>
                                    <input type="text" class="form-control form-time" name="zztime" value="{$form.zztime}" id="zztime">
                                </div>
                                <div class="form-group">
                                    <label>邀约进店时间:</label>
                                    <input type="text" class="form-control form-time" name="yytime" value="{$form.yytime}" id="yytime">
                                </div>
                                <div class="form-group">
                                    <label>实际到店时间:</label>
                                    <input type="text" class="form-control form-time" name="ddtime" value="{$form.ddtime}" id="ddtime">
                                </div>
                                <div class="form-group">
                                    <label>门店分配时间:</label>
                                    <input type="text" class="form-control form-time" name="mdfptime" value="{$form.mdfptime}" id="mdfptime">
                                </div>
                                <div class="form-group">
                                    <label>流失时间:</label>
                                    <input type="text" class="form-control form-time" name="lstime" value="{$form.lstime}" id="lstime">
                                </div>
                                <div class="form-group">
                                    <label>未到店时间:</label>
                                    <input type="text" class="form-control form-time" name="wddtime" value="{$form.wddtime}" id="wddtime">
                                </div>
                                <div class="form-group">
                                    <label>未到流失时间:</label>
                                    <input type="text" class="form-control form-time" name="yywdlstime" value="{$form.yywdlstime}" id="yywdlstime">
                                </div>
                                <div class="form-group">
                                    <label>成交时间:</label>
                                    <input type="text" class="form-control form-time" name="cjtime" value="{$form.cjtime}" id="cjtime">
                                </div>
                                <div class="form-group">
                                    <label>无效时间:</label>
                                    <input type="text" class="form-control form-time" name="wxtime" value="{$form.wxtime}" id="wxtime">
                                </div>
                                <div class="form-group">
                                    <label>最后操作时间:</label>
                                    <input type="text" class="form-control form-time" name="cztime" value="{$form.cztime}" id="cztime">
                                </div>

                            </div>
                            <button class="btn btn-primary" onclick="search()">开始查询</button>

                            <!--<a type="submit" class="btn btn-primary" id="querybtn">开始查询</a>-->
                            <a href="javascript:;" onclick="formReset()" class="btn btn-danger">重置表单</a>
                            <a href="javascript:daoru('{:url('daoru/daoru')}')" class="btn btn-warning">导入excel</a>
                            <a href="javascript:daorufail('{:url('daoru/index')}')" class="btn btn-danger">导入失败信息</a>
                            <button class="btn btn-warning" id="button">生成报表</button>
                        </form>
                        <form   method="get"  action="{:url('olist')}" id="resetform" style="display: none;" >
                            <input type="submit"  value="fsdfsd">
                        </form>
                    </div>
                    
                </header>
                <div class="panel-body">
                    <div class="adv-table editable-table ">
                        <!-- <div>
                            <a class="btn btn-primary" style="margin-top: -10px; margin-bottom: 5px;"
                               href="{:url('add')}">
                                新增订单 <i class="fa fa-plus"></i>
                            </a>
                        </div> -->
                        
                    </div>
                    
                     <div class="tile-body nopadding" >
                         <div class="table_onelevel">
                            <div class="row">
                                <div class="col-md-12 col-xs-12">
                                    <div class="col-md-1 col-xs-1 col-md-enlarge btn-change {eq name="$form.state_k" value="0"}active{/eq}">
                                        <button class="btn btn-primary btn-ordinary btn-ordinary-1 state_btn" data-state="0">全部订单</button>
                                    </div>
                                    <div class="col-md-1 col-xs-1 btn-change {eq name="$form.state_k" value="1"}active{/eq}" style="padding: 0">
                                        <button class="btn btn-primary btn-ordinary state_btn" data-state="1">新客咨（{$number1}）</button>
                                    </div>
                                    <div class="col-md-1 col-xs-1 btn-change {eq name="$form.state_k" value="4"}active{/eq}" style="padding: 0">
                                        <button class="btn btn-primary btn-ordinary state_btn" data-state="4">免费体验（{$number4}）</button>
                                    </div>
                                    <div class="col-md-1 col-xs-1 btn-change {eq name="$form.state_k" value="10"}active{/eq}" style="padding: 0">
                                        <button class="btn btn-primary btn-ordinary state_btn" data-state="10">无效客咨（{$number10}）</button>
                                    </div>
                                    <div class="col-md-1 col-xs-1 btn-change {eq name="$form.state_k" value="6"}active{/eq}" style="padding: 0">
                                        <button class="btn btn-primary btn-ordinary state_btn" data-state="6">无需追踪（{$number6}）</button>
                                    </div>

                                </div>
                            </div>
                         </div>
                    </div>

                         <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                             <thead>
                                 <tr>
                                     <!--<th class="center">-->
                                         <!--<label class="position-relative">-->
                                             <!--<input type="checkbox" class="ace" />-->
                                             <!--<span class="lbl"></span>-->
                                         <!--</label>-->
                                     <!--</th>-->
                                     <th>编号</th>
                                     <th>顾客姓名</th>
                                     <th>主联系电话</th>
                                     <th>副联系电话</th>
                                     <th>微信</th>
                                     <th>QQ</th>
                                     <th>宝宝名字</th>
                                     <th>宝宝生日</th>
                                     <th>宝宝年龄</th>
                                     <th>宝宝性别</th>
                                     <th>活动</th>
                                     <th>拍摄方式</th>
                                     <th>地区</th>
                                     <th>渠道</th>
                                     <th>来源/校区</th>
                                     <th>班级</th>
                                     <th>上课时间</th>
                                     <th>状态</th>
                                     <th>邀约客服</th>
                                     <th>追踪日期</th>
                                     <th>渠道备注</th>
                                     <th>邀约备注</th>
                                     <th>拍摄时间</th>
                                     <th>预约进店时间</th>
                                     <th>预约门店</th>
                                     <th>门店接待</th>
                                     <th>建单人员</th>
                                     <th>建单部门</th>
                                     <th>建单时间</th>
                                     <th>操作时间</th>
                                     <th>操作</th>
                                 </tr>
                             </thead>

                             <tbody>
                                 {volist name="list" id='info'}
                                 <tr>
                                     <!--<td class="center">-->
                                         <!--<label class="position-relative">-->
                                             <!--<input type="checkbox" class="ace" />-->
                                             <!--<span class="lbl"></span>-->
                                         <!--</label>-->
                                     <!--</td>-->
                                     <td>{$info.id}</td>
                                     <td>{$info.name_z}</td>
                                     <td>{$info.phone_z}</td>
                                     <td>{$info.phone_f}</td>
                                     <td>
                                         {neq name="$info.wechat" value=""}
                                         {$info.wechat}
                                         {eq name="$info.jwxtype" value="0"}
                                         <i class="fa fa-wechat" aria-hidden="true" style="color: red;" title="未加微信"></i>
                                         {else/}
                                         <i class="fa fa-wechat" aria-hidden="true" style="color: #0bb20c" title="已加微信"></i>
                                         {/eq}
                                         {/neq}
                                     </td>
                                     <td>{$info.qq}</td>
                                     <td>{$info.bbname}</td>
                                     {eq name="$info.bbcstime" value="1970-01-01"}
                                     <td></td>
                                     {else/}
                                     <td>{$info.bbcstime}</td>
                                     {/eq}
                                     <td>{$info.bbage}</td>
                                     <td>{$info.gender_b_text}</td>
                                     <td>{$info.activity_text}</td>
                                     <td>{$info.shot_mode_text}</td>
                                     {eq name="$info.diqu" value="0"}
                                     <td></td>
                                     {else/}
                                     <td>{$info.diqu}</td>
                                     {/eq}
                                     {if condition="$info['channel_path_text'] neq ''"}
                                     <td style="text-align: left;">
                                         <img src="{$info.channel_path_text}" style="width: 16px;height: 16px;">
                                         <span style="display: inline-block">{$info.channel_text}</span>
                                     </td>
                                     {else/}
                                     <td>{$info.channel_text}</td>
                                     {/if}
                                     <td>{$info.source_text}</td>
                                     <td>{$info.banji_text}</td>
                                     <td>{$info.xingqi}{$info.shijianduan}</td>
                                     <td>{$info.state_text}</td>
                                     <td>{$info.yykf_text}</td>
                                     {eq name="$info.zztime" value="1970-01-01 08:00:00"}
                                     <td></td>
                                     {else/}
                                     <td>{$info.zztime}</td>
                                     {/eq}
                                     <td><div class="wrap">{$info.qdbz}</div></td>
                                     <td><div class="wrap">{$info.yybz}</div></td>
                                     {eq name="$info.yypstime" value="1970-01-01 08:00:00"}
                                     <td></td>
                                     {else/}
                                     <td>{$info.yypstime}</td>
                                     {/eq}
                                     {eq name="$info.yyjdtime" value="1970-01-01 08:00:00"}
                                     <td></td>
                                     {else/}
                                     <td>{$info.yyjdtime}</td>
                                     {/eq}
                                     <td>{$info.mendian_text}</td>
                                     <td>{$info.menshi_text}</td>
                                     <td>{$info.jdry_text}</td>
                                     <td>{$info.jd_depar_text}</td>
                                     <td>{$info.jdtime}</td>
                                     <td>{$info.cztime}</td>
                                     <td>
                                         <a href="javascript:showlayer('{:url('edit',['id'=>$info['id']])}','修改客资({$info.states_text})&nbsp;&nbsp;{$info.name_z}-{$info.phone_z}&nbsp;&nbsp;编号：{$info.id}');" alt="查看" title="查看">
                                             <i class="fa fa-search"></i>
                                         </a>
                                         <a href="javascript:showlayer('{:url('allot',['id'=>$info['id'],])}','分配客资({$info.states_text})');" alt="分配" title="分配">
                                             <i class="fa fa-sitemap" aria-hidden="true"></i>
                                         </a>
                                         <a href="javascript:del('{:url('del',['id'=>$info['id']])}');" alt="删除" title="删除"><i class="fa fa-trash-o"></i></a>
                                         <!--<a href="javascript:showlayer('{:url('invalid',['id'=>$info['id'],])}','反无效');" alt="返无效" title="返无效">
                                             <i class="fa fa-refresh" title="返无效"></i>
                                         </a>-->
                                     </td>
                                 </tr>
                                {/volist}
                             </tbody>
                         </table>
                         <div class="page">{$page}</div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
<!--body wrapper end-->
{/block}
{block name="js"}
<!--引入时间插件-->
<script type="text/javascript" src="__STATIC__/daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="__STATIC__/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/date.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/common.js"></script>
<!-- 引入layui脚本 -->
<script type="text/javascript" src="__STATIC__/common/layui/layui.js"></script>
<!--<script type="text/javascript" src="__STATIC__/common/laydate/laydate.js"></script>-->
<!--引入多选-start-->
<!--<script type="text/javascript" src="__STATIC__/admin/multiselect/docs/js/prettify.js"></script>-->
<script type="text/javascript" src="__STATIC__/admin/multiselect/dist/js/bootstrap-multiselect.js"></script>
<script>
    $(function () {
        //收起侧边栏菜单
        $('#sidebar').addClass('menu-min');

        var diqu = $('#diqu');
        var mendian = $('#mendian');
        var menshi = $('#menshi');
        var yykf = $('#yykf');
//        channel.change(function () {
//            qudao.empty();
//            $.post("{:url('common/getSourceByChennel')}", {qudao: $(this).val()}, function (data) {
//                if(data == ''){
//                    $("<option value=''>" + '暂无来源' + "</optinon>").appendTo(qudao);
//                }else{
//                    $.each(eval(data), function (i, n) {
//                        $("<option value='" + n.id + "'>" + n.title + "</optinon>").appendTo(qudao);
//                    });
//                }
//
//            });
//        });
        /*修改客资获取对应的邀约组员*/
//        $('#yykf_group').change(function () {
//            var id = $('#yykf_group').val();
//            var divs = $('#yykf');
//            groupinvit(id, divs);
//        });
        //备注信息弹出窗
        $('.wrap').on('mouseover',function () {
            layer.tips($(this).html(), $(this), {
                tips: [1, 'rgb(53,149,204)'],
                time: 4000
            });
        });
        layui.use('laydate', function(){
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#shijianduan' ,
                type: 'time',
                range: true
            });
        });
        //查询订单状态
        $('.state_btn').on('click',function () {
            var state_val = $(this).attr('data-state');
            $.post("{:url('stateIsMap')}",{state_k:state_val},function (res) {
                window.location.href = res.url;
            });
        });

        diqu.change(function () {
            if ($(this).val() == '') {
                mendian.empty();
                yykf.empty();
                $("<option value=''>" + '请选择门店' + "</optinon>").appendTo(mendian);
                $("<option value=''>" + '请选择邀约客服' + "</optinon>").appendTo(yykf);
            } else {
                mendian.empty();
                yykf.empty();
                $("<option value=''>" + '请选择邀约客服' + "</optinon>").appendTo(yykf);
                $("<option value=''>" + '请选择门店' + "</optinon>").appendTo(mendian);
                $.post("{:url('getYykf')}", {diqu: $(this).val()}, function (data) {
                    $.each(eval(data), function (i, n) {
                        $("<option value='" + n.id + "'>" + n.username + "</optinon>").appendTo(yykf);
                    });
                });
                $.post("{:url('getMendian')}", {dq_id: $(this).val()}, function (data) {
                    $.each(eval(data), function (i, n) {
                        $("<option value='" + n.id + "'>" + n.title + "</optinon>").appendTo(mendian);
                    });
                });
            }
        });

        mendian.change(function () {
            if ($(this).val() == '') {
                menshi.empty();
                $("<option value=''>" + '请选择门市' + "</optinon>").appendTo(menshi);
            } else {
                menshi.empty();
                $("<option value=''>" + '请选择门市' + "</optinon>").appendTo(menshi);
                $.post("{:url('getMenshi')}", {group_id: $(this).val()}, function (data) {
                    $.each(eval(data), function (i, n) {
                        $("<option value='" + n.id + "'>" + n.username + "</optinon>").appendTo(menshi);
                    });
                });
            }
        });
    });

    function getquanxian(name) {
        $.get(name, function (msg) {
            if (msg.status == 1) {
                location.href = msg.url;
            } else {
                layer.msg(msg.info, {icon: msg.icon});
            }
        });
    }

    function getfpqx(name) {
        $.get(name, function (msg) {
            if (msg.status == 1) {
                fenpei(msg.url);
            } else {
                layer.msg(msg.msg, {icon: msg.icon});
            }
        });
    }

    function getxcyc(name) {
        $.get(name, function (msg) {
            if (msg.status == 1) {
                layer.msg(msg.msg, {icon: 1, time: 2000});
                setTimeout("history.go(0)", 2000);
            } else {
                layer.msg(msg.msg, {icon: 4, time: 2000});
            }
        });
    }

    function jptfx(name) {
        $.get("{:url('makejpt')}", {id: name}, function (data) {

            layer.confirm('金夫人自选摄影师平台：' + data.url_short, {
                btn: ['复制', '取消'] //按钮
            }, function () {
                $('.layui-layer-btn0').attr('data-clipboard-text', '金夫人自选摄影师平台：' + data.url_short);
                var clipboard = new Clipboard('.layui-layer-btn0');
                layer.msg('复制成功', {icon: 1});
            }, function () {

            });
        });

    }

    $(function () {
        $("[data-toggle='tooltip']").tooltip();
    });

</script>
<script type="text/javascript">
    function but(name) {
        layer.open({
            type: 2,
            title: '查看订单',
            shadeClose: true,
            shade: 0.8,
            area: ['600px', '90%'],
            content: name //iframe的url
        });
    }

    function getfankui(name) {
        $.get(name, function (data) {
            if (data.status == 0 || data.code == 0) {
                layer.msg(data.msg, {
                    icon: data.icon,
                    time: 2000,
                }, function () {
                    history.go(0);
                });
            } else {
                layer.open({
                    type: 2,
                    title: '返馈无效',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['46%', '70%'],
                    content: name //iframe的url
                });
            }
        });
    }

    function catlog(name) {
        layer.open({
            type: 2,
            title: '日志查看',
            shadeClose: true,
            shade: 0.8,
            area: ['70%', '90%'],
            content: name //iframe的url
        });
    }

    function fenpei(name) {
        layer.open({
            type: 2,
            title: '订单分配',
            shadeClose: true,
            shade: 0.8,
            area: ['600px', '90%'],
            content: name, //iframe的url
            end: function () {
                history.go(0);
            }
        });
    }

    function del(name) {
        layer.confirm('您确实删除订单？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.post(name, function (res) {
                var ico;
                if (res.status == 2) {
                    ico = 2;
                } else if (res.status == 1) {
                    ico = 1;
                } else if (res.status == 0) {
                    ico = 2;
                } else {
                    ico = 4;
                }
                layer.msg(res.msg, {
                    icon: ico,
                    time: 2000,
                }, function () {
                    history.go(0);
                });
            });

        });
    }

    highlight_subnav("{:url('olist')}");
</script>
<script type="text/javascript">
    var optiontext=[
        ['订单状态'],['订单类别'],['渠道'],['来源'],['区域'],['意向度'],['升序'],['邀约组'],['邀约人员'],['建单人员'],['门店'],['门市'],['拍摄方式'],['班级'],['星期几']
    ];

    var options={
        nonSelectedText: '',           //未选择时显示文本
        enableFiltering: true,                 //是否启用搜索功能
        filterPlaceholder: '搜索',              //当启用搜索功能后，搜索文本框的提示内容
        includeSelectAllOption: true,          //是否启用全选功能
        selectAllText: '全选',                //全选选项显示文本
        maxHeight: 400,                       //下拉菜单最大高度
        allSelectedText: '全选',              //全选时显示文本
        selectAllNumber: true,               //是否显示选中个数
        //  buttonWidth: '120px',                 //按钮最大宽度
        nSelectedText: '个已选中' ,           //显示选中4个以后显示文本
        enableClickableOptGroups: true
    };
    // 渠道来源
    var options1={
        nonSelectedText: '渠道',           //未选择时显示文本
        enableFiltering: true,                 //是否启用搜索功能
        filterPlaceholder: '搜索',              //当启用搜索功能后，搜索文本框的提示内容
        includeSelectAllOption: true,          //是否启用全选功能
        selectAllText: '全选',                //全选选项显示文本
        maxHeight: 400,                       //下拉菜单最大高度
        allSelectedText: '全选',              //全选时显示文本
        selectAllNumber: true,               //是否显示选中个数
        //  buttonWidth: '120px',                 //按钮最大宽度
        nSelectedText: '个已选中' ,           //显示选中4个以后显示文本
        enableClickableOptGroups: true,
        onDropdownHide: function (event) {
            $('#channel_text').val($('#channel').val());
            var channel = $('#channel_text').val();
            var obj = $('#source');
            getsource(channel,obj);
        },
    };

    function formReset()
    {
        document.getElementById("resetform").submit();
    }

    $(document).ready(function() {
        // 排序
        divsort();
        /* var groupid = "{:session('admin_user.depar_id')}";
         var obj = $('#invitation-personnel');
         getuserbygroup(groupid,obj);*/
        // 初始化下拉菜单
        options.nonSelectedText=optiontext[0];
        $('#state').multiselect(options);
        options.nonSelectedText=optiontext[1];
        $('#leibie').multiselect(options);
        options.nonSelectedText=optiontext[2];
        $('#channel').multiselect(options1);
        options.nonSelectedText=optiontext[3];
        $('#source').multiselect(options);
        options.nonSelectedText=optiontext[4];
        $('#diqu').multiselect(options);
        options.nonSelectedText=optiontext[5];
        $('#intention').multiselect(options);
        options.nonSelectedText=optiontext[6];
        $('#multiple7').multiselect(options);

        options.nonSelectedText=optiontext[9];
        $('#jdry').multiselect(options);
        /*options.nonSelectedText=optiontext[7];
        $('#invitation_group').multiselect(options);*/
        options.nonSelectedText=optiontext[8];
        $('#yykf').multiselect(options);
        options.nonSelectedText=optiontext[10];
        $('#mendian').multiselect(options);
        options.nonSelectedText=optiontext[11];
        $('#menshi').multiselect(options);
        options.nonSelectedText=optiontext[12];
        $('#shot_mode').multiselect(options);
        options.nonSelectedText=optiontext[13];
        $('#banji').multiselect(options);
        options.nonSelectedText=optiontext[14];
        $('#xingqi').multiselect(options);
    });

    //新增和修改弹出页面
    function showlayer(url,text){
        layer.open({
            type: 2,
            title: text,
            shadeClose: false,
            shade: 0.5,
            area: ['720px', '90%'],
            content:url
        });
    }

    // layui表格
    layui.use('table', function(){
        var table = layui.table;
        var tableIn = table.init('grittable', {
            // page: true,
            limit: 10,
            even: true,
            skin: 'row'
        });
    });

    $('.btn-change').click(function(){
        $(this).addClass('active').siblings('.btn-change').removeClass('active');
    })

    /*修改订单*/
    function editorder() {
        layer.open({
            type: 2,
            title: '订单详情',
            shadeClose: true,
            shade: 0.8,
            area: ['620px', '680px'],
            content: 'tab.html' //iframe的url
        }); 
    }

    //搜索区域排序
    function divsort() {
        // 对div排序
        var list=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16];
        var divs = $("#search .set-block");
        var divhtml = '';
        for(var a=0;a<list.length;a++){
            for(var b=0;b<divs.length;b++){
                if(list[a]==$(divs[b]).attr("data-id")){
                    divhtml += divs[b].outerHTML;
                }
            }
        }
        $("#search").html("").append(divhtml);
        var morehtml="<div class='col-md-12 getmore' id='datemore'>" +
            "<div onclick='getmore(this)'>" +
            "<i class='fa fa-caret-down' ></i>" +
            "</div>"+
            "</div>";
        $("#search").append(morehtml);
        // 排序end
    }

    /*根据渠道获取来源*/
    function getsource(data,obj) {
        if(data != '') {
            $.post("{:url('common/getSourceByChennel')}", {channel: data}, function (result) {
                var html = "";
                obj.html('');
                if (result == '') {
                    html += "<option value='0'>暂无数据</option>";
                    obj.append(html);
                } else {
                    $.each(eval(result), function (i, n) {
                        $("<option value='" + n.id + "'>" + n.title + "</optinon>").appendTo(obj);
                    });
                }
                options.nonSelectedText = optiontext[3];
                $("#source").multiselect("destroy").multiselect(options);
            });
            var banji = $('#banji');
            $.post("{:url('common/getBanjiBySource')}", {source: data}, function (result) {
                var html = "";
                banji.html('');
                // console.log(result);
                // return false;
                if (result == '') {
                    html += "<option value='0' selected='selected'>暂无班级</option>";
                    banji.append(html);
                }else if(result.role==0){
                    return false;
                } else {
                    $.each(eval(result), function (i, n) {
                        $("<option value='" + n.id + "'>" + n.banjiname + "</optinon>").appendTo(banji);
                    });
                }
                options.nonSelectedText=optiontext[13];
                $('#banji').multiselect("destroy").multiselect(options);
            })
        }
    }

    //邀约人员获取
    function groupinvit(id, obj ,yykf){
        $.post("{:url('common/getuserByGroup')}", {depart_id: id}, function (result) {
            var html = '';
            obj.html('');
            if (id == '0') {
                html += "<option value=''>未分配邀约</option>";
            } else {
                if(result.length !=0){
                    for (var i in result) {
                        if (yykf == result[i].id) {
                            html += "<option value='" + result[i].id + "' selected  >" + result[i].username + "</option>";
                        } else {
                            html += "<option value='" + result[i].id + "'>" + result[i].username + "</option>";
                        }
                    }
                }else {
                    html += "<option value='' selected='selected'>暂无邀约人员</option>";
                }

            }
            obj.append(html);
        });
    }
    // var arr = '';

    /*搜索按钮点击事件*/
    function search() {
        // return false;
        var state = $('#state').val();
        $('#state_text').val(state);

        var leibie = $('#leibie').val();
        $('#leibie_text').val(leibie);

        var channel = $('#channel').val();
        $('#channel_text').val(channel);

        var source = $('#source').val();
        $('#source_text').val(source);

        var banji = $('#banji').val();
        $('#banji_text').val(banji);

        var xingqi = $('#xingqi').val();
        $('#xingqi_text').val(xingqi);

        var diqu = $('#diqu').val();
        $('#diqu_text').val(diqu);

        var jdry = $('#jdry').val();
        $('#jdry_text').val(jdry);

        var yykf = $('#yykf').val();
        $('#yykf_text').val(yykf);

        var mendian = $('#mendian').val();
        $('#mendian_text').val(mendian);

        var menshi = $('#menshi').val();
        $('#menshi_text').val(menshi);

        var shot_mode = $('#shot_mode').val();
        $('#shot_mode_text').val(shot_mode);

        var personnel = $('#personnel').val();
        $('#personnel_text').val(personnel);

        var invitation_group = $('#invitation_group').val();
        $('#invitation_group_text').val(invitation_group);

        var invitation = $('#invitation-personnel').val();
        $('#invitation-personnel_text').val(invitation);

    }

    /*导入excel*/
    function daoru(url){
        layer.open({
            type: 2,
            title: '导入客资',
            shadeClose: true,
            shade: 0.8,
            area: ['620px', '80%'],
            content:url,
        });
    }

    /*导入错误excel*/
    function daorufail(url){
        layer.open({
            type: 2,
            title: '导入错误客资',
            shadeClose: true,
            shade: 0.8,
            area: ['80%', '80%'],
            content:url,
        });
    }
    /*导出报表*/
    function daochu(url){
        layer.confirm('确定导出表格？', {
            skin: 'layui-layer-lan', //样式类名
            btn: ['确定','取消'] //按钮
        }, function(index){
            layer.close(index);
            window.location.href = url;
        }, function(){
            layer.msg('下次不要这么调皮了', {
                icon: 2,
            });
        });
    }

    /*验证重复的订单*/
    function validatorInfo(name,value,id) {
        $.post("{:url('getContact')}",{name:name,value:value,id:id},function(date) {
            if(date.valid == false){
                layer.open({
                    type: 2,
                    title: '重复客资订单',
                    shadeClose: true,
                    shade: 0.4,
                    area: ['80%', '80%'],
                    content:'/admin/yewu/ValidatorInfo',
                    moveType:1, //拖拽风格,默认为0(会有个过度的透明框)
                    btn:['取消建单','继续建单'],
                    btn1:function(){
                        layer.closeAll();
                    },
                    btn2:function(index){
                        layer.close(index);
                    }
                });
            }

        });
    }

</script>
{/block}